#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s;
	cin >> s;
	int prev = -1;
	int cur = 0;

	while (cur < s.size())
	{
		if (prev == -1 || s[prev] != s[cur])
		{
			s[++prev] = s[cur++];
		}
		else
		{
			--prev;
			++cur;
		}
	}

	if (prev == -1)
	{
		cout << 0;
	}
	else
	{
		for (int i = 0; i <= prev; i++)
		{
			cout << s[i];
		}
	}

	return 0;
}